<template>
	<uni-popup ref="jiashu_pop">
		<view class="jiashu4s">
			<view class="title">
				加速
			</view>
			<view class="jiashu_content">
				<view class="black_1">
					<view class="text1">
						<uni-number-box class="un"  :min="1" :max="max_speed_up_num" background="#FE903D" color="#fff" v-model="vModelValue"></uni-number-box>
					
					</view>
				</view>
				<view class="text2">加速卡{{acount}}</view>
				
				<view class="black_3" @click="tojiashu()">
					<text class="text1">确认加速</text>
				</view>
			</view>
		</view>
		<view style="height: 20px;"></view>
		<view class="bottom">
			<image class="close" @click="close" src="/static/my/close2.png"></image>
		</view>
		<pay ref="paySuccess"></pay>
	</uni-popup>
</template>

<script>
	export default {
		name: "jiashu",
		data() {
			return {
				vModelValue: 1,
				id: '',
				acount:0,
				max_speed_up_num:0
			}
		},
		methods: {
			open(id,acount,max_speed_up_num) {
				this.id = id
				console.log(max_speed_up_num)
				this.max_speed_up_num = max_speed_up_num
				this.acount =parseInt(acount)
				this.$refs.jiashu_pop.open()
			},
			close() {
				this.$refs.jiashu_pop.close()
			},
			tojiashu() {
				var data = {
					order_id: this.id,
					num:this.vModelValue
				}
				this.api.http.requests('carorder/accelerate', data, res => {
					if (res.code != 200) {
						uni.showToast({
							title: res.msg,
							icon: 'error'
						})
						return
					}
					uni.showToast({
						title: res.msg
					})
					this.close()
					uni.$emit('paySuccsse', {
						type: 1,
						msg: res.msg
					})
				}, "POST")
			},
		}
	}
</script>

<style scoped lang="less">
	.jiashu4s {
		background: linear-gradient(295deg, #D2823A 0%, #EF9164 100%);
		border-radius: 10px;
		padding: 2px;
		text-align: center;
		width: 650rpx;

		.jiashu_content {
			background-color: #F9F3E5;
			border-radius: 10px;
		}

		.title {
			text-align: center;
			font-size: 49rpx;
			font-weight: 800;
			color: #FFFFFF;
			padding: 5px;
		}

		.black_1 {
			text-align: center;
			display: flex;
			justify-content: center;
			padding: 50px 0px 10px 0px;
			.text1{
				// margin: auto;
			}
		}


		.black_2 {
			margin-top: 10px;
			font-size: 26rpx;
			font-weight: bold;
			color: #242424;

			.text1 {
				margin-top: 10px;
			}
		}

		.black_3 {
			padding: 35px 10px 40px 10px;

			.text1 {
				font-size: 32rpx;
				font-weight: bold;
				color: #FFFFFF;
				background: #FE903D;
				border-radius: 18rpx;
				padding: 10px 38px;
			}
		}
	}

	.bottom {
		text-align: center;
	}

	.close {
		text-align: center;
		margin: auto;
		width: 30px;
		height: 30px;
	}
</style>